<%@page import="java.net.*"%>
<%@page import="java.io.*"%>
<%@page import="edu.stanford.prpl.dynUI.*"%>
<%@page import="edu.stanford.prpl.dynUI.templates.*"%>
<%

      // System.out.println("Starting lightweight UI Template package...");
      // request.getContextPath()   // Gets me the current URL
      // PRPLAppClient prplAppClient1 = (PRPLAppClient) session.getAttribute(PRPLManagementUI.APP_CLIENT);
      // String sessionKey = request.getParameter(FacebookParam.SESSION_KEY.toString());

      UIEngine webUI_engine = new UIEngine(UIEngine.devicePlatform.WEB);
      
      // String filePath = application.getRealPath("DynNaviList.template.xml");
      // out.println("DynNaviList.template.xml => "+filePath);


      // String templateFilePath = application.getRealPath("DynNaviList.template.xml");
      String templateFilePath = application.getRealPath("playlist.template.xml");
      webUI_engine.setTemplate(new BufferedReader(new FileReader(templateFilePath)));
      session.setAttribute("MousedeerUIEngine", webUI_engine);

      // String jinzoraMainPageXML_url = "http://prpl.stanford.edu/music/api.php?user=skteh&password=serangga&request=home";
      // String jinzoraMainPageXML_url = "http://prpl.stanford.edu/music/api.php?user=skteh&pass=serangga&request=browse&jz_path=Classical%2FBach%2C+Johann+Sebastian+(1685+-+1750)";
      // URL jinzoraData_xml = new URL(jinzoraMainPageXML_url);
      // BufferedReader in = new BufferedReader(
      //                         new InputStreamReader(jinzoraData_xml.openStream())
      //                     );

      String inputFilePath = application.getRealPath("playlist_data.xml");
      BufferedReader in = new BufferedReader(new FileReader(inputFilePath));
      
      
      Object UIresult = webUI_engine.render(in, "Jinzora", UIEngine.renderType.NORMAL);


      // Object UIresult = webUI_engine.render(new BufferedReader(new FileReader("jinzora_data.xml")), "Jinzora", renderType.NORMAL);
      // Object UIresult = webUI_engine.render(new BufferedReader(new FileReader("jinzora_data.xml")), "Jinzora", renderType.AJAX_WEB_FRAGMENT);
      if (UIresult instanceof String)
          out.println((String)UIresult);
      if (UIresult == null)
          out.println("\n\nUI Result is NULL! \n");


%>